package Pojo;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;

//反馈实体类
public class Feedback {
    private Integer feedback_id;//反馈id(主键)
    private Integer uid;//用户id(用户表主键)
    private Integer room_id;//房间id(房间表主键)
    private String phone;//电话(客户或用户)
    private String rating;//评分
    private String feedback_details;//反馈内容详情
    private Date feedback_date;//反馈提交时间


    //下面的属性用于mybatis表关系查询，一对一，一对多，多对多
    //ps:根据代码需求可以自行添加
    private User user;//用户实体类对象
    private Room room;//房间实体类对象


    @Override
    public String toString() {
        return "Feedback{" +
                "feedback_id=" + feedback_id +
                ", uid=" + uid +
                ", room_id=" + room_id +
                ", phone='" + phone + '\'' +
                ", rating='" + rating + '\'' +
                ", feedback_details='" + feedback_details + '\'' +
                ", feedback_date=" + feedback_date +
                ", user=" + user +
                ", room=" + room +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Feedback feedback = (Feedback) o;
        return Objects.equals(feedback_id, feedback.feedback_id) &&
                Objects.equals(uid, feedback.uid) &&
                Objects.equals(room_id, feedback.room_id) &&
                Objects.equals(phone, feedback.phone) &&
                Objects.equals(rating, feedback.rating) &&
                Objects.equals(feedback_details, feedback.feedback_details) &&
                Objects.equals(feedback_date, feedback.feedback_date) &&
                Objects.equals(user, feedback.user) &&
                Objects.equals(room, feedback.room);
    }

    @Override
    public int hashCode() {
        return Objects.hash(feedback_id, uid, room_id, phone, rating, feedback_details, feedback_date, user, room);
    }

    public Integer getFeedback_id() {
        return feedback_id;
    }

    public void setFeedback_id(Integer feedback_id) {
        this.feedback_id = feedback_id;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public Integer getRoom_id() {
        return room_id;
    }

    public void setRoom_id(Integer room_id) {
        this.room_id = room_id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getRating() {
        return rating;
    }

    public void setRating(String rating) {
        this.rating = rating;
    }

    public String getFeedback_details() {
        return feedback_details;
    }

    public void setFeedback_details(String feedback_details) {
        this.feedback_details = feedback_details;
    }

    public String getFeedback_date() {
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        String format = simpleDateFormat.format(this.feedback_date);
        return format;
    }

    public void setFeedback_date(Date feedback_date) {
        this.feedback_date = feedback_date;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    public Feedback() {
    }

    public Feedback(Integer feedback_id, Integer uid, Integer room_id, String phone, String rating, String feedback_details, Date feedback_date, User user, Room room) {
        this.feedback_id = feedback_id;
        this.uid = uid;
        this.room_id = room_id;
        this.phone = phone;
        this.rating = rating;
        this.feedback_details = feedback_details;
        this.feedback_date = feedback_date;
        this.user = user;
        this.room = room;
    }
}
